# Maintainer: Daniel Sabogal <dsabogalcc@gmail.com>
pkgname=hwloc
pkgver=2.8.0
pkgrel=0
pkgdesc="Portable abstraction of hierarchical hardware architectures"
url="https://www.open-mpi.org/"
arch="all"
license="BSD-3-Clause"
makedepends="cairo-dev eudev-dev libxml2-dev ncurses-dev"
case "$CARCH" in
	arm*) true;;
	*) makedepends="$makedepends numactl-dev";;
esac
options="!check" # fails on multiple arches with different tests
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-tools:_tools"
source="https://www.open-mpi.org/software/hwloc/v${pkgver%.*}/downloads/hwloc-$pkgver.tar.bz2"

build() {
	./configure \
		--prefix=/usr \
		--sbindir=/usr/bin \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make -C "$builddir" check
}

package() {
	make -C "$builddir" DESTDIR="$pkgdir" install
}

_tools() {
	pkgdesc="Portable hardware locality tools"

	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
	mkdir -p "$subpkgdir"/usr/share/applications
	mv "$pkgdir"/usr/share/applications/lstopo.desktop "$subpkgdir"/usr/share/applications
}

sha512sums="
025c8ebc2945bdf696cc66fe2cfea0195694713a6098603fb4eaeac409d2f6c3386a7c2b4d7f3758d828f6b621e7f06ffb5745224cb1df2f8ff4f19b2a8a4a7b  hwloc-2.8.0.tar.bz2
"
